package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.lwj.liwanjia.R;

import java.util.List;

/**
 * Created by 001 on 2017/9/22.
 */

public class KuaiDiXuanZeAdapter extends RecyclerView.Adapter<KuaiDiXuanZeAdapter.ViewHolder> {

    private Context mContext;
    private List<String> mList;

    public KuaiDiXuanZeAdapter(Context mContext, List<String> mList) {
        this.mContext = mContext;
        this.mList = mList;

    }

    @Override
    public KuaiDiXuanZeAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        View view = LayoutInflater.from(mContext).inflate(R.layout.adapter_kuai_di_xuan_ze, parent, false);

        ViewHolder holder = new ViewHolder(view);

        return holder;
    }

    @Override
    public void onBindViewHolder(KuaiDiXuanZeAdapter.ViewHolder holder, int position) {

        String name = mList.get(position);

        holder.tv_name.setText(name);

    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {

        View view;
        TextView tv_name;
        ImageView iv_kuaiDiYuan;

        public ViewHolder(View itemView) {
            super(itemView);

            view = itemView;
            tv_name = (TextView) itemView.findViewById(R.id.tv_name);
            iv_kuaiDiYuan = (ImageView) itemView.findViewById(R.id.iv_kuaiDiYuan);
        }
    }

}
